<link rel="stylesheet" href="__PUBLIC__/bootstrap/css/bootstrap.min.css">
	<link href="__PUBLIC__/bootstrap/css/bootstrap.datepicker/bootstrap-datepicker3.min.css" rel="stylesheet" />
	<script src="__PUBLIC__/bootstrap/js/jquery.min.js"></script>
	<script src="__PUBLIC__/bootstrap/js/bootstrap/bootstrap.min.js"></script>
	 <script src="__PUBLIC__/bootstrap/js/bootstrap.datepicker/js/bootstrap-datepicker.min.js"></script>
    <script src="__PUBLIC__/bootstrap/js/bootstrap.datepicker/locales/bootstrap-datepicker.zh-CN.min.js"></script>
    <style type="text/css">
		#form-group{
			padding: 5px 0;
		}
    </style>
    <script type="text/javascript">
    $(function () {
        $(".datepicker").datepicker({
            language: "zh-CN",
            autoclose: true,//选中之后自动隐藏日期选择框
            clearBtn: true,//清除按钮
            todayBtn: true,//今日按钮
            format: "yyyy-mm-dd"//日期格式，详见 http://bootstrap-datepicker.readthedocs.org/en/release/options.html#format
        });
    });
</script> 
<div style="margin: 10px">
<button class="btn btn-primary"  data-toggle="modal" data-target="#add-abnormal">新增</button> 
<a class="btn btn-default"  href="{:U('Depart/Prod/prodinfo',array('type'=>2))}">低温储罐</a>
<a class="btn btn-info"  href="{:U('Depart/Prod/prodinfo',array('type'=>5,'start'=>1))}">气瓶</a>
<div class="modal fade" id="myModal" tabindex="1">
	<div class="modal-dialog" >
		<div class="modal-content">
		</div>
	</div>
</div>
<table class="table table-bordered table-hover">
	<caption style="text-align: center">NCR一览表</caption>
	<thead style="text-align: center">
		<tr>
			<th>NCR号</th>
			<th>涉及数量</th>
			<th>责任部门</th>
			<th>签发人</th>
			<th>签发日期</th>
			<th>回复人</th>
			<th>回复日期</th>
			<th>预计完成</th>
			<!-- <th>设计人</th> -->
			<th>操作</th>
		</tr>
	</thead>
	<tbody>
		<foreach name='data' item="v">
			<tr>
				<td>{$v['sn']}</td>
				<td>{$v['qty']}</td>
				<td>{$v['depart']}</td>
				<td>{$v['signer']}</td>				
				<td>{$v['sign']|date='m.d',###}</td>
				<empty name="v['reply']">				
				<td colspan="3">
					<a href="javascript:;" id="{$v['id']}" onclick="reply(this)">回复</a>
				</td>
				<else />
				<td>{$v['replyer']}</td>
				
				<td>{$v['reply']|date='m.d',###}</td>
				
				<td>{$v['plan']|date='m.d',###}</td>
				</empty>
				<!-- <td>{$v['dname']}</td> -->
				<td>
					<a  class="btn btn-default"  href="{:U('Depart/Abnormal/itemdetail',array('id'=>$v['aid']))}">详情</a> <!-- |
					<a href="javascript:if(confirm('确定删除？'))location='{:U('Depart/Dwg/del_dwg',array('id'=>$v['id']))}'">删除</a> -->
				</td>
			</tr>
		</foreach>
	</tbody>
</table>
</div>
<!-- 开不合格单模态框开始 -->
<div class="modal fade" id="add-abnormal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
	<div class="modal-dialog">
		 <div class="modal-content">
			<div class="modal-header">
				<button type="button" class="close" data-dismiss="modal" aria-hidden="true">
					&times;
				</button>
				<h4 class="modal-title" id="myModalLabel">
					新增NCR报告
				</h4>
			</div>
			<div class="modal-body">
				<form id="add-abnormal" class="form-inline" action="{:U('Depart/Abnormal/add_abnormal')}" method="post">
					<!-- <input type="hidden" name="aid"> -->
					<table class="table table-striped table-bordered table-hover table-condensed">
						<tr>
							<th width="20%">NCR编号：</th>
							<td>
								<input class="form-control" type="text" name="sn">
							</td>
						</tr>
						<tr>
							<th>涉及数量：</th>
							<td>
								<input class="form-control" type="text" name="qty"> 
							</td>
						</tr>
						<tr>
							<th>责任部门：</th>
							<td>
								<select class="form-control" name="departid">
								    <foreach name="map['depart']" item="v">
								    	<option value={$v['id']}>{$v['title']}</option>
								    </foreach>
							    </select>
							</td>
						</tr>
						<tr>
							<th></th>
							<td>
								<input class="btn btn-success" type="submit" value="新增">
							</td>
						</tr>
					</table>
				</form>
			</div>
		</div>
	</div>
</div>
<!-- 确认生产计划模态框结束 -->

<div class="modal fade" id="prod-plan" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
	<div class="modal-dialog">
		 <div class="modal-content">
			<div class="modal-header">
				<button type="button" class="close" data-dismiss="modal" aria-hidden="true">
					&times;
				</button>
				<h4 class="modal-title" id="myModalLabel">
					生产计划
				</h4>
			</div>
			<div class="modal-body">
				<form id="dwg-form" class="form-inline" action="{:U('Depart/Prod/prod_plan')}" method="post">
					<input type="hidden" name="id">
					<input type="hidden" name="item">
					<table class="table table-striped table-bordered table-hover table-condensed">
						<tr>
							<th width="20%">产品编号：</th>
							<td>
								<input class="form-control" type="text" name="prodbatch">
							</td>
						</tr>
						<tr>
							<th>请确认日期：</th>
							<td>
								<input type="text" class="datepicker form-control" placeholder="请选择日期" name="date"/>
							</td>
						</tr>
						<!-- <tr>
							<th>计划完工：</th>
							<td>
								<input type="text" class="datepicker form-control" placeholder="请选择日期" name="planednd"/> 
							</td>
						</tr> -->
						<tr>
							<th></th>
							<td>
								<input class="btn btn-success" type="submit" value="修改">
							</td>
						</tr>
					</table>
				</form>
			</div>
		</div>
	</div>
</div>
<!-- 确认生产计划模态框结束 -->

<script type="text/javascript">
	// 修改菜单
function edit(obj){
	var id=$(obj).attr('id');
	var prodbatch=$(obj).attr('prodbatch');
	var type=$(obj).attr('type');
	$("input[name='id']").val(id);
	$("input[name='prodbatch']").val(prodbatch);
	$("input[name='type']").val(type);
	$('#prod-dwg').modal('show');
}
	
function plan(obj){
	var id=$(obj).attr('id');
	var prodbatch=$(obj).attr('prodbatch');
	var item=$(obj).attr('item');
	$("input[name='id']").val(id);
	$("input[name='prodbatch']").val(prodbatch);
	$("input[name='item']").val(item);
	$('#prod-plan').modal('show');
}
</script>